﻿using System;
using System.Data;

namespace GlobalStore.DataAccess.Transactioning
{
    public class NHibernateReadWriteTransactionScope : NHibernateTransactionScope
    {
        public NHibernateReadWriteTransactionScope(IsolationLevel isolationLevel, TimeSpan transactionTimeout)
            : base(false, isolationLevel, transactionTimeout, true) { }

        public NHibernateReadWriteTransactionScope(bool recreateDatabase, IsolationLevel isolationLevel, TimeSpan transactionTimeout)
            : base(recreateDatabase, isolationLevel, transactionTimeout, true) { }

        public override void Complete()
        {
            Session.Flush();
            transactionScope.Commit();
        }
    }
}